import React, { useEffect } from "react"
import { View, WebView } from "@tarojs/components"
import "./online.scss"
import {
  showToast,
  useDidShow
} from "@tarojs/taro"
import NavLayout from "@@/components/layout/nav.layout"

const OnlinePage = () => {


  useEffect(() => {
    // console.log("online")
  }, [])
  useDidShow(() => {
    // new (window as any).JMYDModel({
    //   url: 'http://dahua-qianduan.51jianmo.com/model.jm2',
    //   el: '#model',
    //   progress: (e: any) => {
    //     console.log(e)
    //   },
    //   data: () => {
    //     return { ...data, type: "jm2" }
    //   },
    //   loaded: () => {
    //     console.log('load')
    //   }
    // })
  })
  const goDetail = (e) => {
    showToast({
      title: e.detail + 'xxxx',
      icon: 'none'
    });

    Taro.switchTab({
      url: '/pages/index/index'
    })
  }

  return <NavLayout border leftIconType="chevron-left" title="线上云展" color="#141414" id="FancyPage">
    {/* <WebView src={`http://${window.location.host}/pages/model/model?env=${TARO_ENV}`} onMessage={goDetail}></WebView> */}
    <WebView src={`http://192.168.10.112:100/pages/model/model?env=${TARO_ENV}`} onMessage={goDetail}></WebView>
  </NavLayout>
}
export default OnlinePage
